<template>
  <div class="wrap headerwrap">
    <!-- logo -->
    <div class="logo">
      <img src="@/assets/img/indexLogo.6f8ac4f0.png" alt="" />
    </div>
    <!-- 导航 -->
    <div>
      <ul class="navs">
        <li
          @click="$router.push('/home')"
          :class="{ curr: $route.path === '/home' }"
        >
          首页
        </li>
        <li
          @click="$router.push('/goods')"
          :class="{ curr: $route.path === '/goods' }"
        >
          全部商品
        </li>
        <li
          @click="$router.push('/user')"
          :class="{ curr: $route.path === '/user' }"
        >
          个人中心
        </li>
        <li
          @click="$router.push('/order')"
          :class="{ curr: $route.path === '/order' }"
        >
          我的订单
        </li>
        <li
          @click="$router.push('/free')"
          :class="{ curr: $route.path === '/free' }"
        >
          专属福利
        </li>
      </ul>
    </div>
    <!-- 搜索 -->
    <div class="search">
      <input type="text" v-model="searchVal" />
      <span @click="searchValFn">
        <img src="@/assets/img/search.png" alt="" />
      </span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      searchVal: "",
    };
  },
  methods: {
    searchValFn() {
      console.log(this.searchVal);
      this.$router.push(`/goods?keyword=${this.searchVal}`);
    },
  },
};
</script>

<style lang="less" scoped>
* {
  list-style: none;
  text-decoration: none;
}
.headerwrap {
  display: flex;
  justify-content: space-between;
  height: 118px;
  align-items: center;
  .navs {
    display: flex;
    width: 500px;
    justify-content: space-between;
    .curr {
      color: #0a328e;
    }
  }
  .search {
    display: flex;
    input {
      width: 214px;
      height: 40px;
      border-radius: 20px 0px 0px 20px;
      box-sizing: border-box;
    }
    span {
      width: 50px;
      height: 40px;
      background: #0a328e;
      border-radius: 0px 20px 20px 0px;

      img {
        margin-top: 12px;
        margin-left: 14px;
      }
    }
  }
}
</style>